-- 解析
local origin = '{"errcode":0,"errmsg":"123","data":"Gateway"}'

local tjsondata, result, errinfo = json.decode(origin)
if result then
    log.info("jsonTest.decode errcode ",tjsondata["errcode"])
    log.info("jsonTest.decode errmsg ",tjsondata["errmsg"])
    log.info("jsonTest.decode data ",tjsondata["data"])
else
    log.info("jsonTest.decode error", errinfo)
end


-- 编码
local torigin = 
{
    errcode = 0,
    errmsg = "123",
    data = "Gateway",
}
local jsondata = json.encode(torigin)
log.info("testJson.encode",jsondata)